package com.swt.controller.T_controller;

import com.alibaba.fastjson.JSON;
import com.swt.domain.Aboutcourse;
import com.swt.domain.Club;
import com.swt.domain.Course;
import com.swt.service.T_service.SigInService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class SigInController {
    @Resource(name = "TSigInService")
    private SigInService sigInService;
//   查询当日的课程信息
    @RequestMapping("/SigInQuery")
    @ResponseBody
    public String SigInQuery(int courseClubid , String courseTime, HttpServletRequest httpServletRequest){
        Club club = (Club) httpServletRequest.getSession().getAttribute("CLUB_SESSION_KEY");
        int clubClubId = club.getClubId();
        List<Course> courseList = sigInService.sigInQuery(courseClubid,courseTime,clubClubId);

        return JSON.toJSONString(courseList);
    }
//查询指定课程的预约人数
    @RequestMapping("/SigInQueryAboutcourse")
    @ResponseBody
    public String SigInQueryAboutcourse(int courseId){
        List<Aboutcourse> List = sigInService.sigInQueryService(courseId);

        return JSON.toJSONString(List);
    }
//修改签到状态
    @RequestMapping("/SigInQueryStatus")
    @ResponseBody
    public String SigInQueryStatus(int Id,String Status){
        boolean boo = sigInService.SigInUpdateStatusService(Id,Status);

        return JSON.toJSONString(boo);
    }




    public SigInService getSigInService() {
        return sigInService;
    }

    public void setSigInService(SigInService sigInService) {
        this.sigInService = sigInService;
    }
}
